<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>进制转换算法</title>
</head>

<body>
    <script>
        /* 将十进制数转换为2-36进制中任意进制的数 */
        let ten2random = function (dealNum, base) {
            const digits = '0123456789ABCDEFGHJKLMNPQRSTUVWXYZ';
            let stack = [];
            while (dealNum > 0) {
                stack.push(dealNum % base);
                dealNum = Math.floor(dealNum / base);
            }
            let res = '';
            while (stack.length > 0) {
                res += digits[stack.pop()];
            };
            return res;
        }
        let res = ten2random(12222, 16);
        console.log(res);



    </script>
</body>

</html>